package com.mc.developmentkit.utils;

import android.widget.Toast;
import org.xutils.x;

public class ToastUtil {

	   private static String oldMsg;  
	    protected static Toast toast   = null;  
	    private static long oneTime=0;  
	    private static long twoTime=0;  
	      
	    public static void showToast(String s){
	        if(toast==null){   
	            toast =Toast.makeText(x.app(), s, Toast.LENGTH_SHORT);
	            toast.show();  
	            oneTime=System.currentTimeMillis();  
	        }else{  
	            twoTime=System.currentTimeMillis();  
	            if(s.equals(oldMsg)){  
	                if(twoTime-oneTime>Toast.LENGTH_SHORT){  
	                    toast.show();  
	                }  
	            }else{  
	                oldMsg = s;  
	                toast.setText(s);  
	                toast.show();  
	            }         
	        }  
	        oneTime=twoTime;  
	    }  

}
